#ifndef I2C_CONTROLLER_H_
#define I2C_CONTROLLER_H_


#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_i2c.h"
#include "misc.h"
#include "FlightDataStruct.h"

void UpdateI2CDAQ(struct FlightDataStruct* state);
int readRegisterMag(int deviceAddressRead,int deviceAddressWrite, char address);
void reset_I2C(void);
void init_I2C(void);
void init_I2C1(void);
void I2C_start(I2C_TypeDef* I2Cx, uint8_t address, uint8_t direction);
void I2C_write(I2C_TypeDef* I2Cx, uint8_t data);
uint8_t I2C_read_ack(I2C_TypeDef* I2Cx);
uint8_t I2C_read_nack(I2C_TypeDef* I2Cx);
void I2C_stop(I2C_TypeDef* I2Cx);
int readRegister(int deviceAddress, char address);
int init_Gyro(void);


#endif
